package threaddemo;

import java.util.Scanner;

public class demo6 {
    private volatile static int isQuit = 0;
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            while (isQuit == 0) {

            }
            System.out.println("线程退出");
        });
        t1.start();


        Thread t2 = new Thread(() -> {
            System.out.println("请输入");
            Scanner sc = new Scanner(System.in);
            isQuit = sc.nextInt();
        });
        t2.start();
    }
}
